<template>
    <div>
      <p>评论:<textarea v-model="content">

      </textarea></p>
      <p><button @click="btn">添加</button></p>
    </div>
</template>

<script>
    export default {
        data(){
          return{
            user:'',
            news:'',
            content:'',
            list:[],
            comment_count:0,
            user_id:sessionStorage.getItem('user_id'),
            uid:this.$route.params.id
          }
        },
        methods:{
          btn(){
            let form_data=new FormData()
            form_data.append('user',this.user_id)
            form_data.append('news',this.uid)
            form_data.append('content',this.content)
            form_data.append('comment_count',this.comment_count)
            axios({
              url:'http://127.0.0.1:8000/app01/addcomment/',
              method:'post',
              data:form_data
            }).then(res=>{
              console.log(res)
            })
          }
        },
        created() {
          console.log(this.user_id)
        }
    }
</script>

<style scoped>

</style>